package com.yuzhyn.hiops.common.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yuzhyn.azylee.websdk.model.users.UserFileConf;
import lombok.Data;

import java.time.LocalDateTime;


@Data
@TableName("sys_user_file_conf")
public class SysUserFileConf {

    @TableId("user_id")
    private String userId;
    private LocalDateTime createTime;
    private LocalDateTime expiryTime;
    private Long spaceLimit;
    private Long usedSpace;
    private String urlPrefix;

    public static SysUserFileConf fromUserFileConf(UserFileConf conf) {
        SysUserFileConf userFileConf = new SysUserFileConf();
        userFileConf.setUserId(conf.getUserId());
        userFileConf.setCreateTime(conf.getCreateTime());
        userFileConf.setExpiryTime(conf.getExpiryTime());
        userFileConf.setSpaceLimit(conf.getSpaceLimit());
        userFileConf.setUsedSpace(conf.getUsedSpace());
        userFileConf.setUrlPrefix(conf.getUrlPrefix());
        return userFileConf;
    }

    public UserFileConf toUserFileConf() {
        UserFileConf userFileConf = new UserFileConf();
        userFileConf.setUserId(this.getUserId());
        userFileConf.setCreateTime(this.getCreateTime());
        userFileConf.setExpiryTime(this.getExpiryTime());
        userFileConf.setSpaceLimit(this.getSpaceLimit());
        userFileConf.setUsedSpace(this.getUsedSpace());
        userFileConf.setUrlPrefix(this.getUrlPrefix());
        return userFileConf;
    }
}
